From 7126177413e73356d5e29c519c7d4fbcb0d6f45e Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 18 Oct 2005 10:45:29 +0100 Subject: [PATCH] In the shadow mode, thanks to recent patches, the shadow reference counts (both general counts and type counts) are now correct in all of my testing so far. As a result, we should remove the shadow_tainted_refcnt flag from the domain structure. Leaving this flag in place would create confusion for programmers and would also prevent future debugging of problems in handling general and type reference counts in the shadow mode. In addition, the patch also (1) drops the requirement that shadow_mode_disable() should only be called in the domain destruction sequence (even though it is only used that way so far), and (2) strictly assert that the type reference count must be 0 when we free a page from the dom heap. Signed-off-by: Khoa Huynh --- xen/arch/x86/shadow32.c | 8 -------- xen/arch/x86/shadow_public.c | 8 -------- xen/common/page_alloc.c | 3 +-- xen/include/asm-x86/domain.h | 2 -- xen/include/asm-x86/shadow.h | 2 -- xen/include/xen/shadow.h | 1 - 6 files changed, 1 insertion(+), 23 deletions(-) diff --git a/xen/arch/x86/shadow32.c b/xen/arch/x86/shadow32.c index 0b88448181..18b5dc448f 100644 --- a/xen/arch/x86/shadow32.c +++ b/xen/arch/x86/shadow32.c @@ -1187,14 +1187,6 @@ void __shadow_mode_disable(struct domain *d) if ( unlikely(!shadow_mode_enabled(d)) ) return; - /* - * Currently this does not fix up page ref counts, so it is valid to call - * only when a domain is being destroyed. - */ - BUG_ON(!test_bit(_DOMF_dying, &d->domain_flags) && - shadow_mode_refcounts(d)); - d->arch.shadow_tainted_refcnts = shadow_mode_refcounts(d); - free_shadow_pages(d); free_writable_pte_predictions(d); diff --git a/xen/arch/x86/shadow_public.c b/xen/arch/x86/shadow_public.c index 36266128df..b27c1086f6 100644 --- a/xen/arch/x86/shadow_public.c +++ b/xen/arch/x86/shadow_public.c @@ -879,14 +879,6 @@ void __shadow_mode_disable(struct domain *d) if ( unlikely(!shadow_mode_enabled(d)) ) return; - /* - * Currently this does not fix up page ref counts, so it is valid to call - * only when a domain is being destroyed. - */ - BUG_ON(!test_bit(_DOMF_dying, &d->domain_flags) && - shadow_mode_refcounts(d)); - d->arch.shadow_tainted_refcnts = shadow_mode_refcounts(d); - free_shadow_pages(d); free_writable_pte_predictions(d); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index d4ae62ee2e..d2321a747e 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -610,8 +610,7 @@ void free_domheap_pages(struct pfn_info *pg, unsigned int order) for ( i = 0; i < (1 << order); i++ ) { shadow_drop_references(d, &pg[i]); - ASSERT(((pg[i].u.inuse.type_info & PGT_count_mask) == 0) || - shadow_tainted_refcnts(d)); + ASSERT((pg[i].u.inuse.type_info & PGT_count_mask) == 0); pg[i].tlbflush_timestamp = tlbflush_current_time(); pg[i].u.free.cpumask = d->cpumask; list_del(&pg[i].list); diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index aece57a6c3..fb9eff7ee4 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -32,8 +32,6 @@ struct arch_domain struct shadow_ops *ops; unsigned int shadow_mode; /* flags to control shadow table operation */ unsigned int shadow_nest; /* Recursive depth of shadow_lock() nesting */ - /* Shadow mode has tainted page reference counts? */ - unsigned int shadow_tainted_refcnts; /* shadow hashtable */ struct shadow_status *shadow_ht; diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index 3e2f3b9d6a..93bd92aaf7 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -55,8 +55,6 @@ #define shadow_mode_translate(_d) ((_d)->arch.shadow_mode & SHM_translate) #define shadow_mode_external(_d) ((_d)->arch.shadow_mode & SHM_external) -#define shadow_tainted_refcnts(_d) ((_d)->arch.shadow_tainted_refcnts) - #define shadow_linear_pg_table ((l1_pgentry_t *)SH_LINEAR_PT_VIRT_START) #define __shadow_linear_l2_table ((l2_pgentry_t *)(SH_LINEAR_PT_VIRT_START + \ (SH_LINEAR_PT_VIRT_START >> (L2_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT)))) diff --git a/xen/include/xen/shadow.h b/xen/include/xen/shadow.h index 4248b30f80..a69bd59802 100644 --- a/xen/include/xen/shadow.h +++ b/xen/include/xen/shadow.h @@ -12,7 +12,6 @@ #define shadow_drop_references(_d, _p) ((void)0) #define shadow_sync_and_drop_references(_d, _p) ((void)0) -#define shadow_tainted_refcnts(_d) (0) #endif -- 2.30.2